package com.reds.backend.utils.adminUtils.admin;

import cn.dev33.satoken.stp.StpInterface;
import com.reds.backend.pojo.Admin;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.reds.backend.mapper.adminMapper;
import java.util.ArrayList;
import java.util.List;

@Component
public class StpAdminInterfaceImpl implements StpInterface {
    @Autowired
    adminMapper adminMapper;
    @Override
    public List<String> getPermissionList(Object loginId, String loginType) {
        return null;
    }

    @Override
    public List<String> getRoleList(Object o, String s) {
        List<String> list = new ArrayList<>();
        if(adminMapper.selectById(StpAdminUtil.getLoginIdAsInt()).getRole().equals("超级管理员")){
            list.add("superAdmin");
            list.add("admin");
        }else if(adminMapper.selectById(StpAdminUtil.getLoginIdAsInt()).getRole().equals("管理员")){
            list.add("admin");
        }
        return list;
    }
}
